<template>
    <div class="body">
        <img :src="shareImg" alt="">
    </div>
</template>

<script>
    import {axiosPost} from "../../axios";
    import {Toast} from "mint-ui";

    export default {
        name: "",
        data(){
            return{
                shareImg:'',
                type:''
            }
        },
        mounted() {
            if(this.$route.query.task_id){
                this.type = 1;
            }else{
                this.type = 2;
            }
            this.getErweima();
        },
        methods:{
            //获取二维码
            getErweima(){
                axiosPost('qrcode/build',{
                    'type':this.type,
                    'task_id':this.$route.query.task_id,
                    'user_id':this.$route.query.user_id
                },(res)=>{
                    //console.log(res)
                    if(res.code!==1){
                        Toast({
                            message:res.msg,
                            duration: 1000
                        });
                        return
                    }
                    this.shareImg = res.data;
                });
            }
        }
    }
</script>

<style scoped lang="less">
    @import "../../style/default";
    .body{
        img{
            width: 100%;
        }
    }
</style>